
const axios = require('axios')

const response_url = 'http://gitlab.sibionics.com:8989';
// 公用 access_token
const access_token = 'RfVEb_4WncedJdQrE3xh';
// 我自己的 access_token
// const access_token = 'xAwp-yRxEpUpyrn4Ru8e';

const headers = { 'Private-Token': access_token };

axios.interceptors.response.use(({ data }) => data);

module.exports = {
    // 获取项目模板列表
    getRepoList: async () => {
        return axios.get(`${response_url}/api/v4/groups/157`, { headers });
    },
    // 获取当前用户拥有的所有仓库的列表
    // getWarehouseList: async () => {
    //     const orgName = 'Frontend';
    //     const teamSlug = 156;
    //     return axios.get(`${response_url}/orgs/${orgName}/teams/${teamSlug}/teams`, { headers });
    // },
    // 创建新项目
    createWarehouse: async (params) => {
        return axios.post(`${response_url}/api/v4/projects`, {
            auto_init: true,
            ...params,
        }, { headers });
    },
};
